package com.xiaohao.ctdemo.controller;

import com.mathworks.toolbox.javabuilder.MWException;
import com.xiaohao.ctdemo.service.DrugService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 *
 * @author 小浩
 * @date 2018-08-27 16:19
 * @package com.xiaohao.ctdemo.controller
 * @description
 */
@RestController
public class DrugController {

    @Autowired
    DrugService drugService;

    @RequestMapping("/drug")
    public List drug(String name) {
        System.out.println(name);

        List list = null;
        try {
            list = drugService.drug(name);
        } catch (IOException e) {
            e.printStackTrace();
        } catch (MWException e) {
            e.printStackTrace();
        }
        return list;
    }
}
